package com.sgb.kjwl.view.ui.activity.ShoppingCar;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.apeng.permissions.EsayPermissions;
import com.apeng.permissions.OnPermission;
import com.chuanglan.shanyan_sdk.OneKeyLoginManager;
import com.sgb.contract.view.widget.TagBuilder;
import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.api.GsonManager;
import com.sgb.kjwl.databinding.ActivityStatementBinding;
import com.sgb.kjwl.di.shopping.DaggerStatementComponent;
import com.sgb.kjwl.di.shopping.StatementModule;
import com.sgb.kjwl.model.entity.LoginEntity;
import com.sgb.kjwl.model.entity.UserMsgEntity;
import com.sgb.link.entity.WebSiteAddressEntity;
import com.sgb.kjwl.model.entity.request.CheckGoodsOrderEntity;
import com.sgb.kjwl.model.entity.request.CheckGoodsOrderResultEntity;
import com.sgb.kjwl.model.entity.request.SubmitGoodsOrderEntity;
import com.sgb.kjwl.model.entity.shopping.PurchasingTypeEntity;
import com.sgb.kjwl.model.entity.shopping.ShoppingCarResponse;
import com.sgb.kjwl.model.entity.user.OneKeyLoginEntity;
import com.sgb.link.entity.InvoiceManagementEntity;
import com.swgk.core.util.ACAdminDialogUtils;
import com.sgb.kjwl.utils.ConfigUtils;
import com.swgk.core.util.UserOperating;
import com.swgk.core.event.EventConstant;
import com.sgb.link.event.LeaseEvent;
import com.sgb.kjwl.view.event.LoginEvent;
import com.sgb.kjwl.view.ui.activity.manage.WebSiteAddressActivity;
import com.sgb.kjwl.view.ui.activity.self.InvoiceAddActivity;
import com.sgb.kjwl.view.ui.activity.self.InvoiceManagementActivity;
import com.sgb.kjwl.view.ui.activity.self.JoinCompanyActivity;
import com.sgb.kjwl.view.ui.activity.self.authentication.AuthActivity3;
import com.sgb.kjwl.view.ui.activity.self.userInfo.VerificationCodeLoginActivity;
import com.sgb.kjwl.view.ui.adapter.self.order.CheckParentOrderListAdapter;
import com.sgb.kjwl.view.widget.ThreeButtonDialog;
import com.sgb.kjwl.viewmodel.shopping.StatementModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.customview.ItemInputTextView;
import com.swgk.core.dialog.DialogHelper;
import com.swgk.core.dialog.RoundDialog;
import com.swgk.core.mmkvutil.CacheMarker;
import com.swgk.core.mmkvutil.MkvUtils;
import com.swgk.core.util.MToast;
import com.swgk.core.util.SharedPreferenceUtil;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import static com.swgk.core.util.ACAdminDialogUtils.MK_OURINQUIRYPRICELIST;

/****
 * 核对订单
 * @author qiangHeNoooo
 * 2021.04.22
 */
public class StatementActivity extends AppActivity implements ItemInputTextView.OnWholeItemClickListener {
    private ActivityStatementBinding binding;
    @Inject
    StatementModel viewModel;
    private CheckParentOrderListAdapter checkParentOrderListAdapter;
    private List<ShoppingCarResponse> orderList = new ArrayList<>();
    private String addressId = "";
    private String invoice = "";
    private static final String SUCCESS = "SUCCESS";
    public static final int REQUEST_CODE = 1010;
    private List<CheckGoodsOrderResultEntity> checkGoodsOrderResultEntityArrayList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected boolean statusBarDark() {
        return false;
    }


    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerStatementComponent.builder().appComponent(appComponent).statementModule(new StatementModule(this)).build().inject(this);
    }

    @Override
    protected void initView() {
        EventBus.getDefault().register(this);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_statement);
        binding.titleView.setText("核对订单");
        binding.rightView.setVisibility(View.INVISIBLE);
        binding.ivBack.setOnClickListener(this);
        binding.tvCommit.setOnClickListener(this);
        binding.rlAddress.setOnClickListener(this);
        binding.tvAddressAdd.setOnClickListener(this);
        binding.tvAddInvoice.setOnClickListener(this);
        initExpandableListView();
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void init() {
        viewModel.getPurchasingMethod();
        viewModel.getDefaultAddress(1, "100", 1);
        viewModel.getInvoiceInfo();
    }

    public void initPurchasingMethod(PurchasingTypeEntity purchasingTypeEntity) {
        List<ShoppingCarResponse> data = (List<ShoppingCarResponse>) getIntent().getSerializableExtra("PURCHASE_ORDER");
        if (data == null || data.size() == 0) {
            return;
        }
        orderList = data;
        for (ShoppingCarResponse shoppingCarResponse : orderList) {
            shoppingCarResponse.setPurchasingTypeEntity(buildPurchasingType(purchasingTypeEntity));
        }
        loadData();
        binding.llTicket.setOnClickListener(v -> {
            Intent intentIm = new Intent(StatementActivity.this, InvoiceManagementActivity.class);
            intentIm.putExtra("companyNo", SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.COMPANY_NO, ""));
            intentIm.putExtra("type", 2);
            startActivity(intentIm);
        });
    }

    @SuppressLint("SetTextI18n")
    private void loadData() {
        initExpandableListViewData(orderList);
        double totalPrice = getTotalPrice(orderList);
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        binding.tvTotalPrice.setText("¥" + decimalFormat.format(totalPrice));
    }

    private PurchasingTypeEntity buildPurchasingType(PurchasingTypeEntity purchasingTypeEntity) {
        PurchasingTypeEntity entity = new PurchasingTypeEntity();
        entity.setLoading(purchasingTypeEntity.getLoading());
        entity.setReceivingMethod(purchasingTypeEntity.getReceivingMethod());
        entity.setTransport(purchasingTypeEntity.getTransport());
        entity.setUnloading(purchasingTypeEntity.getUnloading());
        entity.setInstallService(purchasingTypeEntity.getInstallService());
        entity.setPurchasingMethod(purchasingTypeEntity.getPurchasingMethod());
        List<PurchasingTypeEntity.PaymentBatch> paymentBatch = purchasingTypeEntity.getPaymentBatch();
        if (paymentBatch != null) {
            PurchasingTypeEntity.PaymentBatch paymentBatchEntity = new PurchasingTypeEntity.PaymentBatch();
            paymentBatchEntity.setName("自定义");
            paymentBatchEntity.setNo("0");
            paymentBatch.add(paymentBatchEntity);
        }
        entity.setPaymentBatch(paymentBatch);
        entity.setPaymentMethod(purchasingTypeEntity.getPaymentMethod());
        return entity;
    }

    private double getTotalPrice(List<ShoppingCarResponse> data) {
        double totalPrice = 0d;
        for (ShoppingCarResponse shoppingCarResponse : data) {
            if (shoppingCarResponse.getItems() != null && shoppingCarResponse.getItems().size() != 0) {
                for (ShoppingCarResponse.ItemsData itemsData : shoppingCarResponse.getItems()) {
                    totalPrice = totalPrice + itemsData.getItemNum() * itemsData.getPrice();
                }
            }
        }
        return totalPrice;
    }

    @SuppressLint("NonConstantResourceId")
    @Override
    public void onMultiClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.rl_address:
            case R.id.tv_address_add:
                WebSiteAddressActivity.Companion.launch(StatementActivity.this, 1, REQUEST_CODE);
                break;
            case R.id.tv_commit:
                if (certification()) {
                    checkOrder();
                }
                break;
            case R.id.tv_add_invoice:
                InvoiceAddActivity.start(StatementActivity.this, "", "");
                break;
            default:
                break;
        }

    }

    private boolean certification() {
        if (!UserOperating.getInstance().isLogged()) {
            jumpLogin();
            return false;
        }
        int type = UserOperating.getInstance().getUserIdentity();
        if (type == 0) {
            if (SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                new ThreeButtonDialog.Builder(StatementActivity.this)
                        .content("当前暂不支持个人用户下单，加入\n企业或认证企业后可下单")
                        .confirm("认证企业")
                        .confirmCallback(v -> AuthActivity3.start(StatementActivity.this)).joinCallback(v -> JoinCompanyActivity.start(getActivity())).show();
                return false;
            }

        } else if (type == 1) {
            int type1 = ACAdminDialogUtils.isPermissionForAsk(MK_OURINQUIRYPRICELIST, false);
            if (type1 != ACAdminDialogUtils.TYPE_NORMAL /*&& !SUCCESS.equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.ENTERPRISE_AUTH, ""))*/) {
                MToast.showToast(StatementActivity.this, "您没有权限，请联系管理员开通");
                return false;
            }
        }
        return true;
    }

    private void checkGoodsOrderItem() {
        if (orderList == null || orderList.size() == 0) {
            MToast.showToast(StatementActivity.this, "请到商品页面选择商品");
            return;
        }
        List<CheckGoodsOrderEntity> checkGoodsOrderEntityList = new ArrayList<>();
        for (ShoppingCarResponse order : orderList) {
            if (order.getItems() != null && order.getItems().size() != 0) {
                for (ShoppingCarResponse.ItemsData itemsData : order.getItems()) {
                    CheckGoodsOrderEntity checkGoodsOrderEntity = new CheckGoodsOrderEntity();
                    checkGoodsOrderEntity.price = itemsData.getPrice();
                    checkGoodsOrderEntity.itemId = String.valueOf(itemsData.getItemId());
                    checkGoodsOrderEntity.skuId = itemsData.getSkuId();
                    checkGoodsOrderEntity.choosePriceType = itemsData.getChoosePriceType();
                    checkGoodsOrderEntityList.add(checkGoodsOrderEntity);
                }
            }
        }
        if (checkGoodsOrderEntityList.size() != 0) {
            viewModel.checkCartItemPrice(checkGoodsOrderEntityList);
        }
    }

    private void jumpLogin() {
        if (MkvUtils.get().getBoolean(MkvUtils.CommomData, CacheMarker.ShanYan, false)) {
            //校验权限
            //申请动态权限
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                //6.0以上运行时权限处理
                EsayPermissions.with(StatementActivity.this).constantRequest().permission(PERMISSIONS).request(new OnPermission() {
                    @Override
                    public void hasPermission(List<String> granted, boolean isAll) {
                        openLoginPage();
                    }

                    @Override
                    public void noPermission(List<String> denied, boolean quick) {
                        openLoginPage();
                    }
                });

            } else {
                //有权限
                openLoginPage();
            }

        } else {
            VerificationCodeLoginActivity.start(this, EventConstant.EVENT_STATEMENT_ACTIVITY_JUMP);
        }
    }

    /**
     * 拉起授权页
     */
    private void openLoginPage() {
        //设置授权页样式
        OneKeyLoginManager.getInstance().setAuthThemeConfig(ConfigUtils.getCJSConfig(this));
        //开始拉取授权页
        DialogHelper.showProgressDialog2(this, null, "数据加载中", 0, true, null, true);
        OneKeyLoginManager.getInstance().openLoginAuth(false, (code, result) -> {
            DialogHelper.dismissProgressDialog();
            if (code != 1000) {
                VerificationCodeLoginActivity.start(StatementActivity.this, EventConstant.EVENT_STATEMENT_ACTIVITY_JUMP);
            }
        }, (code, result) -> {
            DialogHelper.dismissProgressDialog();
            if (code == 1000) {
                OneKeyLoginEntity oneKeyLoginEntity = GsonManager.getInstance().getGson().fromJson(result, OneKeyLoginEntity.class);
                oneKeyLoginEntity.setPlateform("Android");
                viewModel.oneKeyLogin(oneKeyLoginEntity);
            }
        });
    }

    /**
     * 一键登录成功
     */
    public void loginSucceed(LoginEntity loginEntity, String phoneNumber) {
        LoginEvent loginEvent = new LoginEvent();
        loginEvent.setMessageData(phoneNumber);
        loginEvent.setMessageTag(EventConstant.EVENT_STATEMENT_ACTIVITY_JUMP);
        loginEvent.setObject(loginEntity);
        EventBus.getDefault().postSticky(loginEvent);
    }

    public void getUserMsgSucceed(UserMsgEntity userMsgEntity) {
        LoginEvent loginEvent = new LoginEvent();
        loginEvent.setMessageTag(EventConstant.EVENT_USER_MSG);
        loginEvent.setMessageData(userMsgEntity);
        EventBus.getDefault().postSticky(loginEvent);
    }

    private void checkOrder() {
        if (TextUtils.isEmpty(addressId)) {
            MToast.showToast(StatementActivity.this, "请完善收货地址");
            return;
        }
        if (TextUtils.isEmpty(invoice)) {
            MToast.showToast(StatementActivity.this, "请完善发票信息");
            return;
        }
        checkGoodsOrderItem();
    }

    public void setCheckResult(boolean result, List<CheckGoodsOrderResultEntity> checkGoodsOrderResultEntityList) {
        if (result) {
            submitGoodsOrder();
        } else {
            if (checkGoodsOrderResultEntityList == null || checkGoodsOrderResultEntityList.size() == 0) {
                MToast.showToast(StatementActivity.this, "服务器异常,提交订单失败~");
                return;
            }
            checkGoodsOrderResultEntityArrayList = checkGoodsOrderResultEntityList;
            RoundDialog.Builder builder = new TagBuilder(this)
                    .title("温馨提示")
                    .content("当前商品价格发生变化")
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .confirmCallback(this::onDialogOnClick);
            builder.singleBtn(true);
            builder.confirm("知道了");
            builder.show();
        }
    }

    /**
     * 商品最优价发生变化，重新设置商品的价格
     */
    @SuppressLint("SetTextI18n")
    private void onDialogOnClick(View view) {
        for (CheckGoodsOrderResultEntity entity : checkGoodsOrderResultEntityArrayList) {
            for (ShoppingCarResponse order : orderList) {
                if (order.getItems() != null && order.getItems().size() != 0) {
                    for (ShoppingCarResponse.ItemsData itemsData : order.getItems()) {
                        if (entity.skuId.equals(itemsData.getSkuId())) {
                            if (!TextUtils.isEmpty(entity.priceType)) {
                                itemsData.setChoosePriceType(Integer.parseInt(entity.priceType));
                            }
                            itemsData.setPrice(entity.lowPrice);
                        }
                    }
                }
            }
        }
        loadData();
    }

    public void setSubmitGoodsOrderSuccess(String Message) {
        Intent newIntent = new Intent(StatementActivity.this, OrderedSuccessfullyActivity.class);
        newIntent.putExtra(OrderedSuccessfullyActivity.MESSAGE_KEY, Message);
        startActivity(newIntent);
        finish();
    }

    /***
     * 提交订单
     */
    private void submitGoodsOrder() {
        SubmitGoodsOrderEntity submitGoodsOrderEntity = new SubmitGoodsOrderEntity();
        if (!"".equals(addressId)) {
            submitGoodsOrderEntity.setAddress(Integer.parseInt(addressId));
        }
        if (!"".equals(invoice)) {
            submitGoodsOrderEntity.setInvoice(Integer.parseInt(invoice));
        }
        submitGoodsOrderEntity.setComNo(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.COMPANY_NO, ""));
        if (orderList != null && orderList.size() != 0) {
            List<SubmitGoodsOrderEntity.ListItem> listItem = new ArrayList<>();
            for (ShoppingCarResponse shoppingCarResponse : orderList) {
                SubmitGoodsOrderEntity.ListItem.OtherInfo otherInfo = new SubmitGoodsOrderEntity.ListItem.OtherInfo();
                SubmitGoodsOrderEntity.ListItem item = new SubmitGoodsOrderEntity.ListItem();
                List<SubmitGoodsOrderEntity.ListItem.ListDTO> dtoList = new ArrayList<>();
                item.setSupplier(shoppingCarResponse.getCompanyNo());
                ShoppingCarResponse.OtherInfo otherInfos = shoppingCarResponse.getOtherInfos();
                otherInfo.setLoading(otherInfos.getLoading());
                otherInfo.setPurchasingMethod(otherInfos.getPurchasingMethod());
                otherInfo.setReceivingMethod(otherInfos.getReceivingMethod());
                otherInfo.setTransport(otherInfos.getTransport());
                otherInfo.setUnloading(otherInfos.getUnloading());
                otherInfo.setInstallService(otherInfos.getInstallService());
                item.setOtherInfo(otherInfo);
                item.setPaymentMethod(shoppingCarResponse.getPaymentMethod());
                item.setShowPurchasingMethod(shoppingCarResponse.getShowPurchasingMethod());
                for (ShoppingCarResponse.ItemsData itemsData : shoppingCarResponse.getItems()) {
                    SubmitGoodsOrderEntity.ListItem.ListDTO listDTO = new SubmitGoodsOrderEntity.ListItem.ListDTO();
                    listDTO.setCount(itemsData.getItemNum());
                    listDTO.setId(itemsData.getId());
                    listDTO.setPromote(itemsData.getPromoteStatus() == 2);
                    listDTO.setSkuId(itemsData.getSkuId());
                    listDTO.setMoney(itemsData.getPrice());
                    listDTO.setChoosePriceType(itemsData.getChoosePriceType());
                    listDTO.setCommodityId(itemsData.getShopId());
                    dtoList.add(listDTO);
                }
                item.setList(dtoList);
                listItem.add(item);
            }
            submitGoodsOrderEntity.setList(listItem);
        }
        viewModel.saveOrder(submitGoodsOrderEntity);
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(LeaseEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_GOODS_FACTORY_LIJICANYU_KAIPIAOXINXI) {
            if (event.getMessageData() instanceof InvoiceManagementEntity) {
                InvoiceManagementEntity invoiceManagementEntity = (InvoiceManagementEntity) event.getMessageData();
                setInvoiceInformation(invoiceManagementEntity);
                EventBus.getDefault().removeStickyEvent(event);
            }
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            if (requestCode == StatementActivity.REQUEST_CODE) {
                WebSiteAddressEntity webSiteAddressEntity = (WebSiteAddressEntity) data.getSerializableExtra("data");
                if (webSiteAddressEntity != null) {
                    setDefaultAddress(webSiteAddressEntity, false);
                }
            }
        }
    }


    /**
     * 初始化默认地址
     */
    public void initDefaultAddress(List<WebSiteAddressEntity> userAddressEntity) {
        if (userAddressEntity != null && userAddressEntity.size() > 0) {
            boolean hasDefault = false;
            for (WebSiteAddressEntity userDefaultAddressEntity : userAddressEntity) {
                if ("1".equals(userDefaultAddressEntity.getStatus())) {
                    setDefaultAddress(userDefaultAddressEntity, true);
                    hasDefault = true;
                    break;
                }
            }
            if (!hasDefault) {
                setDefaultAddress(userAddressEntity.get(0), true);
            }
        }
    }

    @SuppressLint("SetTextI18n")
    private void setDefaultAddress(WebSiteAddressEntity userDefaultAddressEntity, boolean needSplicingAddress) {
        if (userDefaultAddressEntity != null) {
            addressId = String.valueOf(userDefaultAddressEntity.getId());
            binding.rlAddress.setVisibility(View.VISIBLE);
            binding.rlAddressEmpty.setVisibility(View.GONE);
//            binding.normalTag.setVisibility("1".equals(userDefaultAddressEntity.getStatus()) ? View.VISIBLE : View.GONE);
            String address = userDefaultAddressEntity.itemDetailAddress();
            if (needSplicingAddress) {
                address = userDefaultAddressEntity.getProvince() + userDefaultAddressEntity.getCity() + userDefaultAddressEntity.getArea() + userDefaultAddressEntity.getDetailAddress();
            }
            binding.tvAddressName.setText(userDefaultAddressEntity.getReceivePerson());
            binding.tvAddressMobile.setText(userDefaultAddressEntity.getPhone());
//            binding.tvAddress.setContentAndTag("1".equals(userDefaultAddressEntity.getStatus()) ? "            " + address : "  "+address, viewModel.setTag());
            if ("1".equals(userDefaultAddressEntity.getStatus())) {
                binding.tvAddress.setContentAndTag("    " + address, viewModel.setTag());
            } else {
                binding.tvAddress.setText(address);
            }
        }
    }

    /***
     * 收货地址为空的界面展示
     */
    public void showNoAddress() {
        addressId = "";
        binding.rlAddress.setVisibility(View.GONE);
        binding.rlAddressEmpty.setVisibility(View.VISIBLE);
    }

    /**
     * 初始化发票信息
     */
    public void initDefaultInvoice(List<InvoiceManagementEntity> invoiceManagementEntities) {
        if (invoiceManagementEntities != null && invoiceManagementEntities.size() > 0) {
            boolean hasDefault = false;
            for (InvoiceManagementEntity invoiceManagementEntity : invoiceManagementEntities) {
                if (invoiceManagementEntity.getIsDefault() == 1) {
                    setInvoiceInformation(invoiceManagementEntity);
                    hasDefault = true;
                    break;
                }
            }
            if (!hasDefault) {
                setInvoiceInformation(invoiceManagementEntities.get(0));
            }
        }
    }

    private void setInvoiceInformation(InvoiceManagementEntity managementEntity) {
        if (managementEntity != null) {
            invoice = managementEntity.getId();
            binding.llTicket.setVisibility(View.VISIBLE);
            binding.rlTicketEmpty.setVisibility(View.GONE);

            binding.tvCompany.setText(managementEntity.getCompanyName());
            binding.tvDutyNum.setText(managementEntity.getCreditCode());
            binding.tvBankNo.setText(managementEntity.getBankNumber());
            binding.tvMobile.setText(managementEntity.getPhone());
            binding.tvBankAccount.setText(managementEntity.getBankNo());
            binding.tvBankName.setText(managementEntity.getBank());
            binding.tvConpanyAddress.setText(managementEntity.getAddress());
        }
    }

    /***
     * 发票信息为空的界面展示
     */
    public void invoiceEmpty() {
        invoice = "";
        binding.llTicket.setVisibility(View.GONE);
        binding.rlTicketEmpty.setVisibility(View.VISIBLE);
    }

    /**
     * 初始化ExpandableListView
     * 创建数据适配器adapter，并进行初始化操作
     */
    private void initExpandableListView() {
        checkParentOrderListAdapter = new CheckParentOrderListAdapter(StatementActivity.this, orderList);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(StatementActivity.this);
        binding.recView.setLayoutManager(linearLayoutManager);
        binding.recView.setAdapter(checkParentOrderListAdapter);
    }

    /**
     * 初始化ExpandableListView的数据
     * 并在数据刷新时，页面保持当前位置
     *
     * @param data 购物车的数据
     */
    private void initExpandableListViewData(List<ShoppingCarResponse> data) {
        checkParentOrderListAdapter.setNewData(data);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }


    @Override
    public void OnWholeItemClick(View view) {

    }
}
